#coding=utf-8
import re

'''
' [多行]2.7.4-1 函数长度限制（50行）
'''
def mzcc_udrule_mul2_7_4__1(bufferItem, lineContext):

    # 逻辑开始
    if None == bufferItem.userDefineInfo:
        bufferItem.userDefineInfo = 0;
        bufferItem.lineNum = lineContext.curLineNum;

    # 检测嵌套开始&结束
    results = re.findall(r"{", lineContext.curNspLine);
    bufferItem.userDefineInfo += len(results);
    results = re.findall(r"}", lineContext.curNspLine);
    bufferItem.userDefineInfo -= len(results);

    if 0 == bufferItem.userDefineInfo:
        bufferItem.userDefineInfo = None;
        return 0;

    if (lineContext.curLineNum - bufferItem.lineNum) >= 50:
        bufferItem.userDefineInfo = None;
        return 1;

    return 2;
